<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="/common/head::head('编辑广告机 - 广告机管理后台')"></head>
<!--/* <editor-fold desc="define"> */-->
<!--/*@thymesVar id="adminPath" type="java.lang.String"*/-->
<!--/*@thymesVar id="loginUser" type="com.xmlan.machine.module.user.entity.User"*/-->
<!--/*@thymesVar id="newEntityID" type="java.lang.Integer"*/-->
<!--/*@thymesVar id="machine" type="com.xmlan.machine.module.advertisementMachine.entity.AdvertisementMachine"*/-->
<!--/*@thymesVar id="userList" type="java.util.List<com.xmlan.machine.module.user.entity.SimpleUser>"*/-->
<!--/*@thymesVar id="token" type="java.lang.String"*/-->
<!--/*@thymesVar id="cameraIP" type="com.xmlan.machine.module.advertisementMachine.entity.AdvertisementMachine.cameraIP"*/-->
<!--/* </editor-fold> */-->

<body>
<th:block th:include="/common/header::header('machine')"/>

<main style="z-index: 0;">
  <div class="page-title z-depth-1 blue-grey darken-2">
    <div class="white-text">
      <span class="flow-text">
        <a class="btn-flat tooltipped" data-position="bottom" data-delay="50" data-tooltip="返回列表"
           onclick="history.go(-1);"><i class="material-icons white-text">arrow_back</i></a><span
          th:text="${machine.id==newEntityID?'新增广告机':machine.name}"></span>
      </span>
    </div>
  </div>
  <br/>
  <div id="main-content" class="container">
    <form th:action="@{${adminPath}+'/advertisementMachine/save/'+${machine.id}}" method="post">
      <input name="token" th:value="${token}" type="hidden"/>
      <input id="id" name="id" type="hidden" class="validate" required="required" th:value="${machine.id}"/>
      <input id="longitude" name="longitude" type="hidden" class="validate" th:value="${machine.longitude}"/>
      <input id="latitude" name="latitude" type="hidden" class="validate" th:value="${machine.latitude}"/>
      <input id="light" name="light" type="hidden" class="validate" th:value="${machine.light}"/>
      <input id="charge" name="charge" type="hidden" class="validate" th:value="${machine.charge}"/>
      <input id="checked" name="checked" type="hidden" class="validate" th:value="${machine.checked}"/>
      <input id="addTime" name="addTime" type="hidden" class="validate" th:value="${machine.addTime}"/>
      <input id="accessToken" name="accessToken" type="hidden" class="validate" th:value="${machine.accessToken}"/>

      <div class="row">
        <div class="input-field col s6 m6 l6">
          <i class="material-icons prefix">create</i>
          <input id="name" name="name" type="text" class="validate" placeholder="输入名称" required="required"
                 th:value="${machine.name}"/>
          <label for="name">广告机名称</label>
        </div>
        <div class="input-field col s6 m6 l6">
          <i class="material-icons prefix">account_circle</i>
          <select id="userID-ro" name="userID" th:if="${loginUser.roleID!=adminRoleID}">
            <option th:each="item:${userList}" th:value="*{item.id}" th:text="*{item.username}"
                    th:if="${item.id==machine.userID}" selected="selected"></option>
          </select>
          <label for="userID-ro" th:if="${loginUser.roleID!=adminRoleID}">所属用户</label>
          <select id="userID" name="userID" th:if="${loginUser.roleID==adminRoleID}">
            <option th:each="item:${userList}" th:value="*{item.id}" th:text="*{item.username}"
                    th:if="${item.id==machine.userID}" selected="selected"></option>
            <option th:each="item:${userList}" th:value="*{item.id}" th:text="*{item.username}"></option>
          </select>
          <label for="userID" th:if="${loginUser.roleID==adminRoleID}">所属用户</label>
        </div>

        <div class="input-field col s6 m6 l6" >
          <i class="material-icons prefix">place</i>
          <input id="addrStr" name="addrStr" type="text" class="validate" placeholder="输入地址"
                 th:value="${machine.addrStr}"/>
          <label for="addrStr">广告机地址</label>
        </div>

        <div class="input-field col s6 m6 l6" >
          <i class="material-icons prefix">code</i>
          <input id="codeNumber" name="codeNumber" type="text" class="validate" placeholder="机器识别码"
                 th:value="${machine.codeNumber}"/>
          <label for="codeNumber">机器识别码</label>
        </div>

        <div class="input-field col s12 m12 112">
          <i class="material-icons prefix">insert_comment</i>
          <textarea id="remark" name="remark" class="materialize-textarea" th:text="${machine.remark}"></textarea>
          <label for="remark">备注</label>
        </div>
        <div class="input-field col s6 m6 l6" >
          <i class="material-icons prefix">format_indent_increase</i>
          <input id="LED" name="LED" type="text" class="validate" placeholder="机器识别码"
                 th:value="${machine.LED}"/>
          <label for="LED">LED广告屏编号</label>
        </div>
        <div class="input-field col s6 m6 l6" >
          <i class="material-icons prefix">code</i>
          <input id="cameraIP" name="cameraIP" type="text" class="validate" placeholder="输入ip"
                 th:value="${machine.cameraIP}"/>
          <label for="cameraIP">摄像头IP</label>
        </div>
        <div class="input-field col s6 m6 l6" >
          <i class="material-icons prefix">code</i>
          <input id="cameraVerificationCode" name="cameraVerificationCode" type="text" class="validate" placeholder="输入6位大写英文设备验证码"
                 th:value="${machine.cameraVerificationCode}"/>
          <label for="cameraVerificationCode">摄像头设备验证码</label>
        </div>
        <div class="input-field col s6 m6 16">
          <i class="material-icons prefix">insert_comment</i>
          <input id="cameraSequence" name="cameraSequence" class="validate" type="text" placeholder="输入摄像头9位序列号"
                    th:value="${machine.cameraSequence}"/>
          <label for="cameraSequence">摄像头序列号</label>
        </div>


        <div class="input-field col s6 m6 l6 right-align">
          <button type="reset" class="waves-effect waves-light btn"><i class="material-icons left">clear</i>清空</button>
        </div>
        <div class="input-field col s6 m6 l6 left-align" th:if="${loginUser.id!=10}">
          <button type="submit" class="waves-effect waves-light btn"><i class="material-icons right">send</i>提交</button>
        </div>
      </div>
    </form>
  </div>
</main>

<th:block th:include="/common/footer::footer"/>
<th:block th:include="/common/script::script"/>
<script type="text/javascript">
  $(function () {
    resize_footer(window.screen.width);
    $("#button-nav-menu").sideNav({
      closeOnClick: true,
      draggable: true
    });
    $(".dropdown-button").dropdown();
    $(".date-picker").pickadatee({
      closeOnSelect: true
    });
    $("#userID").material_select();
    $("#userID-ro").material_select();
    toast('[[${message}]]');
  });

</script>
</body>
</html>
